import request from '@/utils/request'

// 查询库存列表
export function listLocalInventory(query) {
  return request({
    url: '/depot/localInventory/list',
    method: 'get',
    params: query
  })
}

// 查询库存详细
export function getLocalInventory(inventoryId) {
  return request({
    url: '/depot/localInventory/' + inventoryId,
    method: 'get'
  })
}

// 新增库存
export function addLocalInventory(data) {
  return request({
    url: '/depot/localInventory',
    method: 'post',
    data: data
  })
}

// 修改库存
export function updateLocalInventory(data) {
  return request({
    url: '/depot/localInventory',
    method: 'put',
    data: data
  })
}

// 删除库存
export function delLocalInventory(inventoryId) {
  return request({
    url: '/depot/localInventory/' + inventoryId,
    method: 'delete'
  })
}


// 查询库存次品量详细
export function getDefectiveQuantityDetails(params) {
  return request({
    url: '/depot/inspection/product/getDefectiveQuantityDetails',
    method: 'get',
    params
  });
}

// 查询库存待检量详细
export function getInspectionQuantityDetails(params) {
  return request({
    url: '/depot/receipt/product/getInspectionQuantityDetails',
    method: 'get',
    params
  })
}

// 查询库存待到货量详细
export function getArrivedQuantityDetails(params) {
  return request({
    url: '/product/ProcuredOrders/product/getArrivedQuantityDetails',
    method: 'get',
    params
  })
}

// 查询库存库龄详细
export function getStockAgeDetails(params) {
  return request({
    url: '/depot/ProcuredStorage/product/getStockAgeDetails',
    method: 'get',
    params
  })
}
//更新预留量/锁定量
export function updateReservedQuantity(data) {
  return request({
    url: '/depot/localInventory/updateReservedQuantity',
    method: 'put',
    data: data
  })
}
// 查询变动记录
export function getReservedList(query) {
  return request({
    url: '/depot/localInventory/listReservedQuantityLog',
    method: 'get',
    params: query
  })
}
// 查询库存锁定量详细
// export function getDefectiveQuantityDetails(productId) {
//   return request({
//     url: '/depot/inspection/product/' + productId,
//     method: 'get'
//   })
// }
